package com.example.budget3.data;

import java.util.Date;



public class TransactionData {
	private String name;
	private float cost;
	private Date timeDate; 
	private boolean type;
	private int id;
	private ExpenseCategory expenseCategory;
	private IncomeCategory incomeCategory;

	public TransactionData(int id, String name, float cost, IncomeCategory category,
			Date timeDate, boolean type) {
		this.id = id;
		this.name = name;
		this.cost = cost;
		this.incomeCategory = category;
		this.timeDate = timeDate;
		this.type = type;
	}

	public TransactionData(int id, String name, float cost, ExpenseCategory category,
			Date timeDate, boolean type) {
		this.id = id;
		this.name = name;
		this.cost = cost;
		this.expenseCategory = category;
		this.timeDate = timeDate;
		this.type = type;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + Float.floatToIntBits(cost);
		result = prime * result
				+ ((expenseCategory == null) ? 0 : expenseCategory.hashCode());
		result = prime * result + id;
		result = prime * result
				+ ((incomeCategory == null) ? 0 : incomeCategory.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result
				+ ((timeDate == null) ? 0 : timeDate.hashCode());
		result = prime * result + (type ? 1231 : 1237);
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		TransactionData other = (TransactionData) obj;
		if (Float.floatToIntBits(cost) != Float.floatToIntBits(other.cost))
			return false;
		if (expenseCategory != other.expenseCategory)
			return false;
		if (id != other.id)
			return false;
		if (incomeCategory != other.incomeCategory)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (timeDate == null) {
			if (other.timeDate != null)
				return false;
		} else if (!timeDate.equals(other.timeDate))
			return false;
		if (type != other.type)
			return false;
		return true;
	}

	public String getName() {
		return name;
	}


	public float getCost() {
		return cost;
	}


	public IncomeCategory getIncomeCategory() {
		return incomeCategory;
	}
	
	public ExpenseCategory getExpenseCategory() {
		return expenseCategory;
	}


	public Date getTimeDate() {
		return timeDate;
	}


	public boolean isExpenseType() {
		return type;
	}

	public int getID() {
		return id;
	}
	

}
